<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>jQuery过滤选择器</title>
    <meta charset="utf-8">
    <script type="text/javascript" src="js/jquery-3.3.-1.js"></script>

    <script type="text/javascript">
          function fun1(){

              $("div[title]").css("background-color","red");
          }

          function fun2(){

              $("div[title^='te']").css("background-color","red");
          }

          function fun5(){

              $("div[title$='st']").css("background-color","red");
          }


          function fun7(){

               $("div[id][title*='te']").css("background-color","red");
          }


    </script>
    <style type="text/css">
        div{
            background: gray;
            width: 200px;
            height: 100px;
        }
        .son{
            background: cyan;
            width: 180px;
            height: 20px;
        }
    </style>
</head>
<body>
    <!--定义被选择对象-->
    <div id="one" title="test">zero</div>
    <div class="c02" title="myTest">one</div>
    <div>
        two
        <div id="three" class="son">three</div>
        <div title="test" class="son">four</div>
    </div>
    <div title="testCase">five</div>
    <div></div>
    <span>我是span标签</span>
    <br><br>
    <!--定义按钮-->
    <input type="button" id="btn01" value="选择包含title属性的div元素" onclick="fun1()"/>
    <input type="button" id="btn02" value="选择title属性值为test的div元素"/>
    <input type="button" id="btn03" value="选择title属性值不为test的div元素"/>
    <input type="button" id="btn04" value="选择title属性以'te'开头的div元素" onclick="fun2()"/>
    <input type="button" id="btn05" value="选择title属性以'st'结尾的div元素" onclick="fun5()"/>
    <input type="button" id="btn06" value="选择title属性包含'es'的div元素"/>
    <input type="button" id="btn07" value="选择title属性包含'es'的并且含有id属性的div元素" onclick="fun7()"/>
</body>
</html>